#include <cstdio>

int main(int argc, char const* argv[])
{
    int n;
    scanf("%d", &n);
    int _1 = 0, _5 = 0, _10 = 0;
    for (int i = 0; i < n; i++) {
        int temp;
        scanf("%d", &temp);
        if (temp == 1) {
            _1++;
        } else if (temp == 5) {
            _5++;
        } else if (temp == 10) {
            _10++;
        }
    }
    printf("%d\n%d\n%d\n", _1, _5, _10);
    return 0;
}